#!/usr/bin/env zsh
# https://github.com/jenniges/dotfiles/blob/master/bspwm/bspwmrc

wid="$1"
class="$2"
instance="$3"

out=()

case $class in
	Soffice | libreoffice)
		case $(xprop -id $wid _NET_WM_WINDOW_TYPE) in
			*_NET_WM_WINDOW_TYPE_NORMAL* ) out+='state=tiled' ;;
		esac
		;;
	Java )
		case $(xprop -id $wid _NET_WM_WINDOW_TYPE) in
			*_NET_WM_WINDOW_TYPE_SPLASH* ) out+='state=floating' ;;
		esac
		;;
	Firefox )
		(( $(bspc query -N -d | wc -l) >= 1 )) && out+='focus=off'
		;;
esac

(( ${#out} )) && print $out
